50fe0ec58d23ec1bed65a9315c8f4ac68f2db537,platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/impl/VirtualFileSystemEntry.java,VirtualFileSystemEntry,getCharset,#,448
Before Change
public Charset getCharset() {
Charset charset;
if (isCharsetSet()) {
charset = super.getCharset();
}
else {
if (isDirectory()) {
Charset configured = EncodingManager.getInstance().getEncoding(this, true);
charset = configured == null ? Charset.defaultCharset() : configured;
setCharset(charset);
}
else if (SingleRootFileViewProvider.isTooLargeForContentLoading(this)) {
charset = super.getCharset();
}
else {
try {
final byte[] content;
try {
content = contentsToByteArray();
}
catch (FileNotFoundException e) {
// file has already been deleted from disk
return super.getCharset();
}
charset = LoadTextUtil.detectCharsetAndSetBOM(this, content);
}
catch (FileTooBigException e) {
return super.getCharset();
}
catch (IOException e) {
throw new RuntimeException(e);
}
}
}
return charset;
}
@Override
After Change
@Override
public Charset getCharset() {
return isCharsetSet() ? super.getCharset() : computeCharset();
}
private Charset computeCharset() {